package com.example.okhttp.vm

import com.example.okhttp.data.EncryptedRequest
import com.example.okhttp.data.RequestData
import com.example.okhttp.net.RetrofitFactory
import com.example.okhttp.test.TEST_RN_PARAM_MOBILE
import com.example.okhttp.test.TEST_RN_PARAM_TYPE
import com.example.okhttp.util.printDe
import com.google.gson.Gson

class SecondFraVM {
    suspend fun requestNet(): String {
        try {
            val requestData = RequestData(TEST_RN_PARAM_TYPE, TEST_RN_PARAM_MOBILE)
            val response = RetrofitFactory.apiService.postEncryptedData(
                EncryptedRequest(Gson().toJson(requestData))
            )

            printDe("解密后的数据: $response")
            return response.data
        } catch (e: Exception) {
            e.printStackTrace()
        }
        return ""
    }
}